﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ECONTACT.Bussiness;
using ECONTACT.DataLayer;
using System.Data;
using System.Windows.Forms;
using DevComponents.DotNetBar.Controls;
using DevComponents.Editors.DateTimeAdv;

namespace ECONTACT.Controller
{
    public class HocLucCtrl
    {
        HocLucData m_HocLucData = new HocLucData();

        public void HienThi(DataGridViewX dGV, TextBoxX txtMaHL, TextBoxX txtTenHL)
        {
            BindingSource bs = new BindingSource();
            bs.DataSource = m_HocLucData.LayDShHocLuc();

            DataTable dt = m_HocLucData.LayDShHocLuc();

            txtMaHL.DataBindings.Clear();
            txtMaHL.DataBindings.Add("Text", bs, "MaHL");

            txtTenHL.DataBindings.Clear();
            txtTenHL.DataBindings.Add("Text", bs, "TenHL");

            dGV.DataSource = bs;
        }

        public void LuuHocLuc(String Ten)
        {
            m_HocLucData.LuuHocLuc(Ten);
        }

        public void UpdateHocLuc(String MaHK, String Ten)
        {
            m_HocLucData.UpdateHocLuc(MaHK, Ten);
        }

        public void DeleteHocLuc(String MaHK)
        {
            m_HocLucData.DeleteHocLuc(MaHK);
        }
    }
}
